package com.htandroid.htandroid.webservice;

import com.htandroid.htandroid.entity.CgglCgList;
import com.htandroid.htandroid.sys.Basenvo;

import java.util.ArrayList;

//生成xml的文本信息
public class BuildCgglscshXMLService {

    public String buildXML(ArrayList<CgglCgList> shlist, String methodName, String namespace, String[] param, String[] val, String param_o) {
        String xmlstring = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>";
        //添加方法名
        xmlstring = xmlstring + "<" + methodName + " xmlns=\"" + namespace + "\"> \r\n";
        //前参
        for (int i = 0; i < param.length; i++) {
            xmlstring = xmlstring + "<" + param[i] + ">" + val[i] + "</" + param[i] + "> \r\n";
        }
        if (shlist != null) {
            //对象参数
            xmlstring = xmlstring + "<" + param_o + ">\r\n";
            for (int i = 0; i < shlist.size(); i++) {
                CgglCgList sh = shlist.get(i);
                xmlstring = xmlstring + "<CgglCgList xmlns=\"http://entity.test.com\">\r\n";//必须指定映射文件所在的路径,否则webservice默认的是当前路径
                xmlstring = xmlstring + "<binvexchtype >" + Basenvo.AdjDigest(sh.getBinvexchtype()) + "</binvexchtype >\r\n";
                xmlstring = xmlstring + "<binvtype>" + Basenvo.AdjDigest(sh.getBinvtype()) + "</binvtype>\r\n";
                xmlstring = xmlstring + "<cQGType >" + Basenvo.AdjDigest(sh.getcQGType()) + "</cQGType >\r\n";
                xmlstring = xmlstring + "<cchangedate >" + Basenvo.AdjDigest(sh.getCchangedate()) + "</cchangedate >\r\n";
                xmlstring = xmlstring + "<cdefine1>" + Basenvo.AdjDigest(sh.getCdefine1()) + "</cdefine1>\r\n";
                xmlstring = xmlstring + "<cdefine2>" + Basenvo.AdjDigest(sh.getCdefine2()) + "</cdefine2>\r\n";
                xmlstring = xmlstring + "<cdefine3>" + Basenvo.AdjDigest(sh.getCdefine3()) + "</cdefine3>\r\n";
                xmlstring = xmlstring + "<cdefine4>" + Basenvo.AdjDigest(sh.getCdefine4()) + "</cdefine4>\r\n";
                xmlstring = xmlstring + "<cdepcode>" + Basenvo.AdjDigest(sh.getCdepcode()) + "</cdepcode>\r\n";
                xmlstring = xmlstring + "<cdepname>" + Basenvo.AdjDigest(sh.getCdepname()) + "</cdepname>\r\n";
                xmlstring = xmlstring + "<cinva_unit>" + Basenvo.AdjDigest(sh.getCinva_unit()) + "</cinva_unit>\r\n";
                xmlstring = xmlstring + "<cinvcode>" + Basenvo.AdjDigest(sh.getCinvcode()) + "</cinvcode>\r\n";
                xmlstring = xmlstring + "<cinvm_unit>" + Basenvo.AdjDigest(sh.getCinvm_unit()) + "</cinvm_unit>\r\n";
                xmlstring = xmlstring + "<cinvname>" + Basenvo.AdjDigest(sh.getCinvname()) + "</cinvname>\r\n";
                xmlstring = xmlstring + "<cinvstd>" + Basenvo.AdjDigest(sh.getCinvstd()) + "</cinvstd>\r\n";
                xmlstring = xmlstring + "<cmaker >" + Basenvo.AdjDigest(sh.getCmaker()) + "</cmaker >\r\n";
                xmlstring = xmlstring + "<cprechecker >" + Basenvo.AdjDigest(sh.getCprechecker()) + "</cprechecker >\r\n";
                xmlstring = xmlstring + "<creplaceitem  >" + Basenvo.AdjDigest(sh.getCreplaceitem()) + "</creplaceitem  >\r\n";
                xmlstring = xmlstring + "<cstatus >" + Basenvo.AdjDigest(sh.getCstatus()) + "</cstatus >\r\n";
                xmlstring = xmlstring + "<cvencode>" + Basenvo.AdjDigest(sh.getCvencode()) + "</cvencode>\r\n";
                xmlstring = xmlstring + "<cvenname>" + Basenvo.AdjDigest(sh.getCvenname()) + "</cvenname>\r\n";
                xmlstring = xmlstring + "<cvouchid>" + Basenvo.AdjDigest(sh.getCvouchid()) + "</cvouchid>\r\n";
                xmlstring = xmlstring + "<cvouchid_qgd >" + Basenvo.AdjDigest(sh.getCvouchid_qgd()) + "</cvouchid_qgd >\r\n";
                xmlstring = xmlstring + "<cvouchnum>" + Basenvo.AdjDigest(sh.getCvouchnum()) + "</cvouchnum>\r\n";
                xmlstring = xmlstring + "<cvouchnum_qgd >" + Basenvo.AdjDigest(sh.getCvouchnum_qgd()) + "</cvouchnum_qgd >\r\n";
                xmlstring = xmlstring + "<dDate_DH >" + Basenvo.AdjDigest(sh.getdDate_DH()) + "</dDate_DH >\r\n";
                xmlstring = xmlstring + "<ddate>" + Basenvo.AdjDigest(sh.getDdate()) + "</ddate>\r\n";
                xmlstring = xmlstring + "<iamount>" + Basenvo.AdjDigest(sh.getIamount()) + "</iamount>\r\n";
                xmlstring = xmlstring + "<id>" + Basenvo.AdjDigest(sh.getId()) + "</id>\r\n";
                xmlstring = xmlstring + "<iinvexchrate>" + Basenvo.AdjDigest(sh.getIinvexchrate()) + "</iinvexchrate>\r\n";
                xmlstring = xmlstring + "<inum>" + Basenvo.AdjDigest(sh.getInum()) + "</inum>\r\n";
                xmlstring = xmlstring + "<inum_sh >" + Basenvo.AdjDigest(sh.getInum_sh()) + "</inum_sh >\r\n";
                xmlstring = xmlstring + "<iprice>" + Basenvo.AdjDigest(sh.getIprice()) + "</iprice>\r\n";
                xmlstring = xmlstring + "<iquantity>" + Basenvo.AdjDigest(sh.getIquantity()) + "</iquantity>\r\n";
                xmlstring = xmlstring + "<iquantity_jy>" + Basenvo.AdjDigest(sh.getIquantity_jy()) + "</iquantity_jy>\r\n";
                xmlstring = xmlstring + "<iquantity_sh>" + Basenvo.AdjDigest(sh.getIquantity_sh()) + "</iquantity_sh>\r\n";
                xmlstring = xmlstring + "<notaxamount>" + Basenvo.AdjDigest(sh.getIamount()) + "</notaxamount>\r\n";
                xmlstring = xmlstring + "<notaxprice>" + Basenvo.AdjDigest(sh.getIprice()) + "</notaxprice>\r\n";
                xmlstring = xmlstring + "<s_cdefine1>" + Basenvo.AdjDigest(sh.getS_cdefine1()) + "</s_cdefine1>\r\n";
                xmlstring = xmlstring + "<s_cdefine2>" + Basenvo.AdjDigest(sh.getS_cdefine2()) + "</s_cdefine2>\r\n";
                xmlstring = xmlstring + "<s_cdefine3>" + Basenvo.AdjDigest(sh.getS_cdefine3()) + "</s_cdefine3>\r\n";
                xmlstring = xmlstring + "<s_cdefine4>" + Basenvo.AdjDigest(sh.getS_cdefine4()) + "</s_cdefine4>\r\n";
                xmlstring = xmlstring + "<tax>" + Basenvo.AdjDigest(sh.getTax()) + "</tax>\r\n";
                xmlstring = xmlstring + "<taxrate>" + sh.getTaxrate() + "</taxrate>\r\n";
                xmlstring = xmlstring + "<venplatid>" + Basenvo.AdjDigest(sh.getVenplatid()) + "</venplatid>\r\n";
                xmlstring = xmlstring + "<ydpriceup>" + Basenvo.AdjDigest(sh.getYdpriceup()) + "</ydpriceup>\r\n";
                xmlstring = xmlstring + "<ydvenup>" + Basenvo.AdjDigest(sh.getYdvenup()) + "</ydvenup>\r\n";
                xmlstring = xmlstring + "</CgglCgList>\r\n";
            }
            xmlstring = xmlstring + "</" + param_o + ">\r\n";
        }
        xmlstring = xmlstring + "</" + methodName + ">\r\n";
        xmlstring = xmlstring + "</soap:Body></soap:Envelope>";
        return xmlstring;
    }
}
